<?php
/**
 * @Title: confv
 * @Description: todo(获取配置值)
 * @param string $k
 * @param string $type
 * @return string
 * @author 若谷
 * @date 2019年1月1日
 * @throws
 */
function confv($k, $type = 'web'){
    $config = new app\common\model\Config;
    return $config->confv($k, $type);
}

/**
 * @Title: goodsCategory
 * @Description: todo(套餐分类)
 * @return array
 * @author 若谷
 * @date 2019年5月21日
 * @throws
 */
function goodsCategory(){
    $where[] = [
        ['uid', '=', UID],
        ['status', '=', 1],
    ];
    $model = new app\common\model\GoodsCategory;
    $list = $model->where($where)->field('id,catename')->order('sort desc')->select();
    $option = [];
    if (!empty($list)){
        foreach ($list as $k => $v){
            $option[$v->id] = $v->catename;
        }
    }
    return $option;
}


/**
 * @Title: auth_rule
 * @Description: todo(权限节点)
 * @return array
 * @author 若谷
 * @date 2019年1月1日
 * @throws
 */
function auth_rule(){
    $authRuleModel = new \app\common\model\AuthRule();
    $list = $authRuleModel->treeList('agent', 1);
    $option = [];
    if (!empty($list)){
        foreach ($list as $k => $v){
            $option[$v->id] = [$v->level, $v->title];
        }
    }
    return $option;
}